//@author A0106044W
package logic;

import java.io.IOException;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

import commandInfo.CommandInfo;
import storage.Task;
import storage.Storage;

/**
 * 
 *
 * 	       Sothearith Sreang
 *         All of the Logic part is written by me.
 * 
 */

public class OperationHandler {
	
	CommandInfo commandInfo;
	Storage storage;
	ArrayList<Task> taskList;
	
	public OperationHandler (){
		
		try{
			storage = Storage.getInstance();
		} catch(Exception e) {
			Logic.logger.log(Level.SEVERE, e.getMessage());
		}
		
		taskList = Logic.getDisplayTaskList();
	}
	

	// methods accessed by Logic class
	
	
	// a list of methods that are overridden
	
	public CommandInfo getCommandInfo() {
		return commandInfo;
	}
	
	// a list of methods that are overridden
	
	public String execute() throws Exception{
		return "";
	}
	
	public String undo(){
		return "";
	}
	
	public String getQuery() {
		return "";
	}
	
	
	// a list of methods accessed by its own child classes
	
	public Task getTask(Task taskDisplay) {
		for (Iterator<Task> tasks = storage.iterator(); tasks.hasNext();) {
			Task t = tasks.next();
			if(t.compareTo(taskDisplay) == 0) {
				return t;
			}
		}
		
		return null;
	}
}
